home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / powerb5.zip / P5UTL003.TIP < prev    next >
Text File  |  1993-06-01  |  2KB  |  76 lines

  1. These days, AUTOEXEC.BAT files are often loaded with
  2. programs to run disk checks, virus checks, and all sorts of
  3. other checks that run when when the computer is switched on.
  4. Some people find this annoying, especially when they're
  5. rebooting in the middle of the day. To keep from being
  6. annoyed more than once a day, I wrote a program in BASIC
  7. called DT.BAS that ensures my PC will do these routine
  8. checks only once a day.
  9.  
  10. 10 OPEN "O",#1,"C:\DT"
  11. 20 D$=DATE$
  12. 30 PRINT #1,D$
  13. 40 CLOSE
  14. 50 OPEN "I",#1,"C:\DT"
  15. 60 A$=INPUT$(8,#1)
  16. 70 ON ERROR GOTO 120
  17. 80 OPEN "I",#2,"C:\TODAY"
  18. 90 B$=INPUT$(8,#2)
  19. 100 IF A$=B$ THEN GOTO 130
  20. 110 CLOSE
  21. 120 SHELL "CHECK.BAT"
  22. 130 SYSTEM
  23.  
  24. A typical AUTOEXEC.BAT that uses the program is shown below.
  25. Every time the PC is switched on, the program compares the
  26. current date to the date in a file called TODAY. If the date
  27. has changed, i.e., if AUTOEXEC.BAT hasn't run today, my
  28. program will run another batch file, CHECK.BAT; this is
  29. where you put the commands to be run only once a day.
  30. DT.BAS, by the way, won't run properly if it can't find
  31. CHECK.BAT. When CHECK.BAT and DT.BAS are finished,
  32. AUTOEXEC.BAT updates the TODAY file to make sure the batch
  33. will run only once.
  34.  
  35. P. B. Mohandas
  36. Manama, State of Bahrain
  37.  
  38. Editor's Note: You don't have to type in Mr. Mohandas' BASIC
  39. program to get it running; it's available as the file
  40. P5UTIL\DT.BAS on your PowerBase *.* Volume 5 diskette. This
  41. solution has an important advantage over others we've
  42. published in previous Star-Dot-Star columns and on our other
  43. PowerBase *.* disks. Some other "one-a-day" schemes stopped
  44. working with the advent of DOS 5.0, but this one, because it
  45. uses a BASIC program, is more immune to changes in DOS. I've
  46. tested it with BASICA and QBASIC, and it runs well with
  47. both, meaning that whatever DOS version you have, you should
  48. be able to run this program.
  49.  
  50. Here's a sample AUTOEXEC.BAT that uses DT.BAS. If you'd
  51. like, you can export the listing to a batch file using the
  52. Alt-F command, then modify it for your own use.
  53.  
  54. ---- BEGIN LISTING ----
  55. ECHO OFF
  56. PATH=C:\DOS;C:\
  57. PROMPT=$P$G
  58. REM If you're running
  59. REM_DOS 5, use
  60. REM QBASIC /RUN DT
  61. REM instead of
  62. REM the following line.
  63. BASICA C:\DT
  64. COPY C:\DT C:\TODAY
  65. DEL C:\DT
  66. CLS
  67. ---- END LISTING ----
  68.  
  69.  
  70. Title: A Better One-a-Day Solution
  71. Category: UTL
  72. Issue Date: April, 1992
  73. Editor: Brett Glass
  74. Supplementary Files: P5UTL\DT.BAS
  75. Filename: P5UTL003.TIP
  76.